﻿using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using Shop.DB;
using Shop.Domain.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Shop.Application.Cart
{
    public class AddCustomerInformation
    {
        private ISession _session;

        public AddCustomerInformation(ISession session)
        {
            _session = session;
        }

        public void Do(CustomerInput model)
        {
            var customerInfo = new CustomerInformation
            {
                UserName = model.UserName,
                Email = model.Email,
                Address = model.Address,
                PhoneNumber = model.PhoneNumber,
                City = model.City,
                PostCode = model.PostCode
            };
            _session.SetString("CustomerInfo", JsonConvert.SerializeObject(customerInfo));
        }
    }
}
